package com.bagu.springmvc_direct_redirect.forward;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@RequestMapping("/test")
@ResponseBody
public class forward2 {

    @GetMapping("/someDo")
    public ModelAndView dosome(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("key1", "value1");
        modelAndView.addObject("key2", "value2");
        modelAndView.setViewName("forward:/page/page1.html");
        return modelAndView;
    }

}